<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>{$region['title']}</title>
    <link rel="stylesheet" href="{MODULE_URL}template/mobile/style/style1/static/css/weui.css" />
    <link rel="stylesheet" type="text/css" href="{MODULE_URL}template/mobile/style/style1/static/css/region.css" />
    <link rel="stylesheet" href="{MODULE_URL}template/mobile/style/style1/static/css/comm.css">
    <script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
    var myurl = "{php echo $this->createMobileUrl('imgupload')}";
    </script>
    <!--图片上传js-->
    <script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
    
    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/global.js">
    </script>

    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/seajs-0.1.5.js">
    </script>
    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/newthread.js">
    </script>
    <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/mobile/style/style1/static/js/jpegmeta.js">
    </script>
    <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/mobile/style/style1/static/js/jpeg.encoder.basic.js">
    </script>
    <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/mobile/style/style1/static/js/image_compress.js">
    </script>
    <style type="text/css">
    body {
        color: #777;
    }
    
    .weui_label {
        font-size: 14px;
        color: #a9a9a9;
        width: 5em;
    }
    .weui_input {
        font-size: 14px;
        color: #a9a9a9;
    }
    
    .weui_select {
        font-size: 14px;
        color: #a9a9a9;
    }
    
    span {
        font-size: 14px;
        color: #a9a9a9;
    }
    
    .add-image {
        clear: both;
        width: 96%;
        padding-left: 4%;
        height: 90px;
        background-color: #FFF;
        border-bottom: 1px solid #dfe9e8;
        border-top: 1px solid #dfe9e8;
        clear: both;
    }
    
    .fileInput {
        height: 100%;
        width: 100%;
        overflow: hidden;
        font-size: 300px;
        position: absolute;
        right: 0;
        top: 0;
        opacity: 0;
        filter: alpha(opacity=0);
        cursor: pointer;
    }
    
    .nav-ul li:hover {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    .nav {
        clear: both;
        width: 100%;
    }
    
    .nav-ul {
        margin: 8px 8px 0 2px;
        overflow: hidden;
    }
    
    .nav-ul li {
        float: left;
        width: 6.1em;
        height: 6.1em;
        margin: 0.5em 1.2em 1em 0;
        box-sizing: border-box;
        position: relative;
    }
    
    .nav-ul li div {
        width: 100%;
        height: 100%;
        line-height: 32px;
        font-size: 12px;
        text-align: center;
        background:url({MODULE_URL}template/mobile/style/style1/static/image/add-img.jpg) no-repeat center;
        background-size: 100%;
    }
    
    .nav-ul li div img {
        margin: 0 !important;
        width: 100%;
        height: 100%
    }
    
    .ui-tabs {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    .ui-tabs-nav {
        list-style: none;
        padding: 0;
        margin: 0;
        z-index: 11;
        position: relative;
        display: -webkit-box;
        display: -moz-box;
        width: 100%;
        margin-bottom: 10px;
    }
    
    .ui-tabs-nav li {
        -webkit-box-flex: 1;
        -moz-box-flex: 1;
        border-right: 1px solid #e4e4e4;
        text-align: center;
        font-size: 18px;
        height: 40px;
        line-height: 40px;
        white-space: nowrap;
        cursor: pointer;
        letter-spacing: 0.5em;
        border-bottom: 3px solid #e4e4e4;
    }
    
    .ui-tabs-nav li a {
        text-decoration: none;
        color: #888;
    }
    
    .ui-tabs-nav li:last-child {
        border-right: none;
    }
    
    .ui-tabs-nav li.ui-state-active {
        color: #48b54e;
        border-bottom: 3px solid #48b54e;
    }
    
    .ui-tabs-nav li.ui-state-active a {
        color: #48b54e;
    }
    .addimg_div{
        width: 65px;
        height: 65px;
        background: url({MODULE_URL}template/mobile/style/style1/static/image/ico_03.png) center no-repeat;
        background-size: 65px;
        float: left;
        margin-top: 5px;
    }
    .checkinput{
        display:inline-block;width:20px;height:1px; position:relative;  overflow:visible;border:0;  background:0 0; -webkit-appearance:none;outline:0;  vertical-align:middle
    }
    .checkinput:before{background:url({MODULE_URL}template/mobile/style/style1/static/image/check.png) no-repeat -18px 0px; background-size:36px auto; content:""; display:block;  width:18px; height:18px;    position:absolute;  left:0; top:-10px}
.checkinput:checked:before{
    background-position:0px 0px
}
    </style>
</head>

<body>
    <header id="header">
        <div class="header_div">
            <div id="left_div" onClick="window.location.href='{php echo $this->createMobileUrl('houselease',array('op' => 'list'))}'"></div>
            <div id="middle_div">
                <h1 id="title">发布{if $category == 1} 出租{elseif $category == 2} 求租{elseif $category == 3} 出售{else} 求购{/if}信息</h1></div>
            <div id="right_div">
                <div class="right_bottom"></div>
                <div class="right_img"></div>
            </div>
        </div>
    </header>
    <div class="cont">
        <ul class="ui-tabs-nav">
            <li {if $category == 1}class="ui-state-active"{/if}><a href="{php echo $this->createMobileUrl('houselease',array('op' => 'add' ,'category' => 1))}">出租</a></li>
            <li {if $category == 2}class="ui-state-active"{/if}><a href="{php echo $this->createMobileUrl('houselease',array('op' => 'add' ,'category' => 2))}">求租</a></li>
            <li {if $category == 3}class="ui-state-active"{/if}><a href="{php echo $this->createMobileUrl('houselease',array('op' => 'add' ,'category' => 3))}">出售</a></li>
            <li {if $category == 4}class="ui-state-active"{/if}><a href="{php echo $this->createMobileUrl('houselease',array('op' => 'add' ,'category' => 4))}">求购</a></li>
        </ul>
        <form role="form" method="post" enctype="multipart/form-data" name="newthread" id="newthread" class="form-horizontal">
        <div class="weui_cells weui_cells_form">
        {if $category == 2}
        <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    求租方式：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" id='way'>
                        <option>请选择求租方式</option>
                        <option value="整套求租">整套求租</option>
                        <option value="单间求租">单间求租</option>
                        <option value="床位求租">床位求租</option>
                    </select>
                </div>
            </div>

        {elseif $category == 3}
        <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    出售方式：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" id='way'>
                        <option>请选择出售方式</option>
                        <option value="整套出售">整套出售</option>
                    </select>
                </div>
            </div>

        {elseif $category == 4}
        <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    求购方式：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" id='way'>
                        <option>请选择整套求购</option>
                        <option value="整套出租">整套求购</option>
                    </select>
                </div>
            </div>
        {else}
        <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    出租方式：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" id='way'>
                        <option>请选择出租方式</option>
                        <option value="整套出租">整套出租</option>
                        <option value="单间出租">单间出租</option>
                        <option value="床位出租">床位出租</option>
                    </select>
                </div>
            </div>

        {/if}
            
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    房屋类型：
                </div>
                <div class="weui_cell_bd">
                    <select class="weui_select" id="model_room">
                        <option value="1">1室</option>
                        <option value="2">2室</option>
                        <option value="3">3室</option>
                        <option value="4">4室</option>
                        <option value="5">5室</option>
                        <option value="6">6室</option>
                        <option value="7">7室</option>
                    </select>
                </div>
                <div class="weui_cell_bd weui_cell_primary" >
                    <select class="weui_select" id="model_hall">

                        <option value="0">0厅</option>
                        <option value="1">1厅</option>
                        <option value="2">2厅</option>
                        <option value="3">3厅</option>
                    </select>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" id="model_toilet">
                        <option value="0">0卫</option>
                        <option value="1">1卫</option>
                        <option value="2">2卫</option>
                        <option value="3">3卫</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">面积：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" id="model_area" placeholder="面积(单位平方米)" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">楼层：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="第多少层" id="floor_layer" />
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="共多少层" id="floor_number" />
                </div>
            </div>
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    装修情况：
                </div>
                <div class="weui_cell_bd">
                    <select class="weui_select" id="fitment">
                        <option value="1">请选择装修</option>
                        <option value="毛坯">毛坯</option>
                        <option value="简单装修">简单装修</option>
                        <option value="中等装修">中等装修</option>
                        <option value="精装修">精装修</option>
                        <option value="豪华装修">豪华装修</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    住宅类别：
                </div>
                <div class="weui_cell_bd">
                    <select class="weui_select" id="house">
                        <option value="1">请选择住宅类别</option>
                        <option value="普通住宅">普通住宅</option>
                        <option value="平房/四合院">平房/四合院</option>
                        <option value="公寓">公寓</option>
                        <option value="别墅">别墅</option>
                        <option value="商住两用">商住两用</option>
                        <option value="其他">其他</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">房屋配置：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input  type="checkbox"  class="checkinput" checked  name="allocation" value="床铺"/><span>床铺</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="家具"/><span>家具</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="煤气"><span>煤气</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="暖气"><span>暖气</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="宽带"><span>宽带</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="电视"/><span>电视</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="空调"/><span>空调</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="冰箱"/><span>冰箱</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="洗衣机"/><span>洗衣机</span>
                    <input  type="checkbox"  class="checkinput"  name="allocation" value="热水器"/><span>热水器</span>
                </div>
            </div>
            {if $category == 1 || $category == 2}
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    押金方式：
                </div>
                <div class="weui_cell_bd">
                    <select class="weui_select" id="price_way">
                        <option value="1">请选择押金方式</option>
                        <option value="押一付一">押一付一</option>
                        <option value="押一付二">押一付二</option>
                        <option value="押一付三">押一付三</option>
                        <option value="押二付一">押二付一</option>
                        <option value="押二付二">押二付二</option>
                        <option value="押二付三">押二付三</option>
                        <option value="面议">面议</option>
                    </select>
                </div>
            </div>
            {/if}
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">{if $category == 3 || $category == 4}总金额{else}租金{/if}：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                {if $category == 3 || $category == 4}
                <input class="weui_input" type="text" placeholder="万元/套" id="price" />
                {else}
                <input class="weui_input" type="text" placeholder="元/月" id="price" />
                {/if}
                    
                </div>
            </div>
            {if $category == 1 || $category == 2}
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">入住时间：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="date" value="今天/随时" id="checktime" />
                </div>
            </div>
            {/if}
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">标题：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="必填项" id="tit" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">姓名：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$member['realname']}" id="realname" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">手机：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$member['mobile']}" id="mobile" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea class="weui_textarea" placeholder="其他说明,长度5-200个字之间。" rows="3" id="content"></textarea>
                    <div class="weui_textarea_counter"><span>0</span>/200</div>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <div class="tipLayer">
                        <div class="photoList">
                            <ul>
                                <li class="on" id="addPic">
                                    <input type="file" class="on needsclick" style="z-index:200;opacity:0;filter:alpha(opacity=0);-ms-filter:'alpha(opacity=0)';" id="uploadFile" accept="image/*" single>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </form>
        <div class="bd spacing" style="text-align:center;margin-top:10px;">
            <a href="javascript:;" class="weui_btn weui_btn_primary" id="showToast" style="width:80%">提交信息</a>
        </div>
        <div id="toast" style="display: none;">
            <div class="weui_mask_transparent"></div>
            <div class="weui_toast">
                <i class="weui_icon_toast"></i>
                <p class="weui_toast_content">成功提交</p>
            </div>
        </div>
    </div>
    <script>
    $(function() {
        select('a1');
    });
    </script>
    <script type="text/javascript">

    $(function() {
        $("#showToast").click(function(event) {
            var title = $("#tit").val();
            if (title == '') {
                alert('标题不能为空！');
                return false
            };
            var model_area = $("#model_area").val();
            if (model_area == '') {
                alert('面积必填！');
                return false
            };
            var floor_layer = $("#floor_layer").val();
            if (floor_layer == '') {
                alert('楼层必填');
                return false
            };
            var price = $("#price").val();
            if (price == '') {
                alert('租金必填！');
                return false
            };
            var allocation = " ";
            if ($('input[name="allocation"]:checked').length >1) {
                $('input[name="allocation"]:checked').each(function(){
                    var t2 = $(this).val();
                       allocation += t2+',';
                });
            }else{
                allocation =$('input[name="allocation"]:checked').val();
            }
            if (allocation == '') {
                alert('房屋配置必须选择！');
                return false
            };
            var category = "{$category}";
            var way = $("#way").val();
            var model_room = $("#model_room").val();
            var model_hall = $("#model_hall").val();
            var model_toilet = $("#model_toilet").val();
            var floor_number = $("#floor_number").val();
            var fitment = $("#fitment").val();
            var house = $("#house").val();
            var price_way = $("#price_way").val();
            var checktime = $("#checktime").val();
            var realname = $("#realname").val();
            var mobile = $("#mobile").val();
            var content = $("#content").val();
            var picIds ='';
            $('input[name="picIds[]"]').each(function(){
                var t1 = $(this).val();
                   picIds += t1+',';
            });
            $.ajax({
                url: "{php echo $this->createMobileUrl('houselease',array('op' => 'add'))}",
                dataType: 'json',
                data: {
                    title: title,
                    category: category,
                    model_area: model_area,
                    floor_layer: floor_layer,
                    price: price,
                    way: way,
                    model_room: model_room,
                    model_hall: model_hall,
                    model_toilet: model_toilet,
                    floor_number: floor_number,
                    fitment:fitment,
                    house:house,
                    allocation:allocation,
                    price_way:price_way,
                    checktime:checktime,
                    realname:realname,
                    mobile:mobile,
                    content:content,
                    picIds :picIds
                },
                success: function(s) {
                    if (s.status == 1) {
                        $('#toast').show();
                        setTimeout(function() {
                            $('#toast').hide();
                             window.location.href="{php echo $this->createMobileUrl('houselease',array('op' => 'list'))}"; 
                        }, 3000);
                    };
                }
            })


        });
    })
    </script>
    {template 'style/style1/footer'}
</body>

</html>
